<?php
	class CheckAction extends BaseAction{
		public function index(){
			$_SESSION['type'] = $_POST['type'];
		}
	
		public function check(){
			$data = $_POST['textfield'];
			if($_SESSION['type']=='' || $_SESSION['type']=='1'){
				import("ORG.Util.Page");
				$count = M("shangpu")->where("x_title like '%$data%'")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("xiezilou")->where("x_title like '%$data%'")->select();
								$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);

				$this->assign("result",$result);
				$this->assign("page",$show);
				$this->display("xcheck");
			}elseif($_SESSION['type']==2){				
				import("ORG.Util.Page");
				$count = M("shangpu")->where("s_title like '%$data%'")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("shangpu")->where("s_title like '%$data%'")->limit($Page->firstRow.','.$Page->listRows)->select();
				$this->assign("result",$result);
								$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);

				$this->assign("page",$show);
				$this->display("scheck");
			}elseif($_SESSION['type']==3){				
				import("ORG.Util.Page");
				$count =  M("bieshu")->where("b_title like '%$data%'")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("bieshu")->where("b_title like '%$data%'")->limit($Page->firstRow.','.$Page->listRows)->select();
								$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);

				$this->assign("result",$result);	
				$this->assign("page",$show);

				$this->display("bcheck");
			}elseif($_SESSION['type']==4){				
				import("ORG.Util.Page");
				$count =  M("vip")->join("xiezilou ON xiezilou.x_broker = vip.v_id")->where("vip.v_name like '%$data%' and vip.v_type=1")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("vip")->join("xiezilou ON xiezilou.x_broker = vip.v_id")->where("vip.v_name like '%$data%' and vip.v_type=1")->limit($Page->firstRow.','.$Page->listRows)->select();
				$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);
				$this->assign("page",$show);
				$this->assign("result",$result);
				$this->display("vip");
			}elseif($_SESSION['type']==5){				
				import("ORG.Util.Page");
				$count =  M("vip")->join("xiezilou ON xiezilou.x_broker=vip.v_id")->where("vip.company like '%$data%' and vip.v_type=2")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("vip")->join("xiezilou ON xiezilou.x_broker=vip.v_id")->where("vip.company like '%$data%' and vip.v_type=2")->select();
				$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);

				$this->assign("result",$result);
				$this->display("vip");
			}elseif($_SESSION['type']==6){
				import("ORG.Util.Page");
				$count =  M("news")->where("title like '%$data%'")->count();
				$Page = new Page($count,10);
				$show = $Page->show();
				$result = M("news")->where("title like '%$data%'")->limit($Page->firstRow.','.$Page->listRows)->select();
				$start = $Page->firstRow+1;
				$end = $start+14;
				if($end>$count){
					$end=$count;
				}
				$this->assign("count",$count);
				$this->assign("start",$start);
				$this->assign("end",$end);
				$this->assign("result",$result);
				$this->assign("page",$show);
				$this->display("new");
			}
		}
	
	
	
	}



?>